import 'package:shared_preferences/shared_preferences.dart';

class StorageUtils {
  /// 保存服务器
  static Future<void> saveServer(String server) async {
    var sp = await SharedPreferences.getInstance();
    sp.setString('server', server);
  }

  /// 获取服务器
  static Future<String> getServer() async {
    var sp = await SharedPreferences.getInstance();
    return sp.getString('server') ?? '';
  }

  /// 保存login
  static Future<void> saveLogin(List<String> data) async {
    var sp = await SharedPreferences.getInstance();
    sp.setStringList('login', data);
  }

  /// 获取login
  static Future<List<String>> getLogin() async {
    var sp = await SharedPreferences.getInstance();
    return sp.getStringList('login') ?? [];
  }
}
